#define _CRT_SECURE_NO_WARNINGS 1


#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
char* build(char* str)
{
    int len = strlen(str);
    char* s = (char*)malloc(sizeof(char) * (len + 1));
    int i = 0;
    while (*str)
    {
        if (*str == '#' && i > 0)
        {
            i--;
        }
        else if(*str != '#')
        {
            s[i++] = *str;
        }
        str++;
    }
    s[i] = '\0';
    return s;
}


bool backspaceCompare(char* s, char* t) {
    return strcmp(build(s), build(t)) == 0;
}
int main()
{
    bool ret = backspaceCompare("y#fo##f", "y#f#o##f");
    printf("%d", ret);
    return 0;
}